﻿/*
 * NewTopic.cs
 * 2008-12-30 By 王霜
 * 2009-1-11  By 林杰
 * 本脚本用于创建专题界面
 *
 */
function NewTopic(button){
 /*
 注意：Ext2.2 自带的css中对checkboxgroup中中文支持不好，需要修改css，修改好的如下：
.x-form-check-wrap,.x-form-radio-wrap
{
	padding:3px 0 0 0;
	line-height:15px;
} 
*+html .x-form-check-wrap,*+html .x-form-radio-wrap
{
	padding:3px 0 0 0;
	line-height:15px;
	width:100px;
	}   
*html .x-form-check-wrap,*html .x-form-radio-wrap
{
	padding:3px 0 0 0;
	line-height:15px;
	width:100px;
	} 
	.x-form-check-group .x-form-check-wrap,.x-form-radio-group .x-form-radio-wrap{height:15px;}

.ext-ie .x-form-check-group .x-form-check-wrap,.ext-ie .x-form-radio-group .x-form-radio-wrap{height:17px;}
*/ 
        var processBar = new Ext.ProgressBar({
                        text:'进度条',
                        id:'pbar2',
                        cls:'left-align',
                        anchor:'95%'
                    });
        var broad=new Ext.form.CheckboxGroup(
        {
            name:'broad',
            id:'broad',
            xtype: 'checkboxgroup',
            fieldLabel:'外国专利',
            items: [

            {boxLabel: ' 美国', name: 'broad',inputValue:'uspatent'},

            {boxLabel: ' 日本', name: 'broad',inputValue:'jppatent'},

            {boxLabel: ' 英国', name: 'broad',inputValue:'gbpatent'},

            {boxLabel: ' 德国', name: 'broad',inputValue:'depatent'},
                {boxLabel: '法国', name: 'broad',inputValue:'frpatent'},
                {boxLabel: '瑞士', name: 'broad',inputValue:'chpatent'},
                {boxLabel: 'EPO', name: 'broad',inputValue:'eppatent'},
                {boxLabel: 'WIPO', name: 'broad',inputValue:'wopatent'}
           ]

        });
      var home=new Ext.form.CheckboxGroup(
        {
            name:'home',
            id:'home',
            xtype: 'checkboxgroup',
            fieldLabel:'中国专利',
			columns: [73, 73,73],
            items: [
                {boxLabel: '发明专利', name: 'home',inputValue:'fmzl'},
                {boxLabel: '外观设计', name: 'home',inputValue:'wgzl'},
                {boxLabel: '实用新型', name: 'home',inputValue:'syxx'}
           ]

        }); 
  var conData = [
      ['AND'],['OR']
  ];
  // 格式化数据
  var ds = new Ext.data.Store({
          proxy: new Ext.data.MemoryProxy(conData), // 数据源
       reader: new Ext.data.ArrayReader({}, [ // 如何解析
                    {
                        name: 'con'
                    }])
  });
  ds.load();
 
  var form=new Ext.FormPanel({
     region: 'center',
     margins: '3 3 3 0',
     frame:true,
     //monitorValid:true,//绑定验证
     labelWidth:80,
     title:"选择专题信息",
     labelAlign:"left",
     //renderTo:Ext.getBody(),
     submit: function(){
                    this.getEl().dom.action = 'GetForm.aspx',
                    this.getEl().dom.method='POST',
                    this.getEl().dom.submit();
              },
    items:[{
                id: 'tb_mc',
                frame:true,
                xtype:'textfield',
                fieldLabel: '专题名称',
                name: 'first',
                anchor:'98%'
            },{
                xtype:'fieldset',
                title: '专利范围选择',
                autoHeight:true,
                items :[broad,home]
            },{
              layout:'column',
              width:520,
              items:[{
                      columnWidth:.5,
                        layout: 'form',                       
                        items: [{
                            xtype:'datefield',
							id:'tb_sqrq_upper_lower_1',
                            fieldLabel: 'A.申请日期',
                            readOnly:true, 
                            format:"Y.m.d",
                            name: 'first',
                            anchor:'95%'
                        }, {
                            id:'tb_ggrq_lower',
                            xtype:'datefield',
                            fieldLabel: 'B.公告日期',
                            readOnly:true,
                            format:"Y.m.d",
                            name: 'company',
                            anchor:'95%'
                        }, {
                            id:'tb_sqrq_lower',
                            xtype:'datefield',
                            fieldLabel: 'C.授权日期',
                            readOnly:true,
                            format:"Y.m.d",
                            name: 'company',
                            anchor:'95%'
                        }]                     
                      },{
                        columnWidth:.5,
                        layout: 'form',
                        labelWidth:20,
                        items: [{     
                            id:'tb_sqrq_upper_1',                      
                            xtype:'datefield',
                            fieldLabel: '至',
                            readOnly:true,
                            format:"Y.m.d",
                            name: 'last',
                            anchor:'80%'
                        },{
                            id:'tb_ggrq_upper',
                            xtype:'datefield',
                            fieldLabel: '至',
                            readOnly:true,
                            format:"Y.m.d",
                            name: 'email',
                            anchor:'80%'
                        },{
                            id:'tb_sqrq_upper',
                            xtype:'datefield',
                            fieldLabel: '至',
                            readOnly:true,
                            format:"Y.m.d",
                            name: 'email',
                            anchor:'80%'
                        }]
                    }]
              },{
              layout:'column',
              items:[{
                      columnWidth:.5,
                        layout: 'form',                       
                        items: [{
                            id:'tb_fmr',
                            xtype:'textfield',
                            fieldLabel: 'D.发明人',
                            name: 'first',
                            anchor:'95%'
                        }, {
                            id: 'tb_zfl',
                            xtype:'textfield',
                            fieldLabel: 'F.主分类',
                            name: 'company',
                            anchor:'95%'
                        }]                     
                      },{
                        columnWidth:.5,
                        layout: 'form',
                        items: [{   
                            id:'tb_sqr',                        
                            xtype:'textfield',
                            fieldLabel: 'E.申请人',
                            name: 'last',
                            anchor:'95%'
                        },{
                            id:'tb_fl',
                            xtype:'textfield',
                            fieldLabel: 'G.分类',
                            name: 'email',
                            anchor:'95%'
                        }]
                    }]
              },{
                layout:'form',
                border:false,
                items:[{
                //columnWidth:.5,
                layout: 'form',
                border:false,
                items: [{
                    id:'tb_dz',
                    xtype:'textfield',
                    fieldLabel: 'H.地址',
                    name: 'add',
                    anchor:'97.5%'
                    }, {
                    id:'tb_qlyq',
                    xtype:'textfield',
                    fieldLabel: 'I.权力项',
                    name: 'right',
                    anchor:'97.5%'
                    },{
                    id:'tb_zy',
                    xtype:'textfield',
                    fieldLabel: 'J.摘要',
                    name: 'abstract',
                    anchor:'97.5%'
                    },{
                    id:'tb_yxq',
                    xtype:'textfield',
                    fieldLabel: 'K.优先权',
                    name: 'first',
                    anchor:'97.5%'
                }]}]
            },{
                layout:'column',             
                items:[{
                  columnWidth:.6,
                    layout: 'form',                       
                    items: [{
                        id:'tb_ljys',
                        xtype:'textfield',                       
                        fieldLabel: '连接运算',
                        name: 'first',
                        anchor:'95%'
                    },processBar]                     
				},{
					  columnWidth:.4,
					  layout:'column',
					  items:[{
					  columnWidth:.7,
					  layout:'form',
					       labelWidth:60,
					  items:[
						  new Ext.form.ComboBox({
			                    store: ds,
			                    fieldLabel: '运算符',
			                    valueField: 'con', // option.value
			                    typeAhead: true,
			                    displayField: 'con', // option.text
			                    triggerAction: 'all',
			                    emptyText: '选择',
			                    mode: 'local',
			                    selectOnFocus: true,
								width:100
			                  }),
							  {
							        id:'tb_jssm',
		                            xtype:'textfield',
		                            fieldLabel: '检索数目',
		                            readOnly:true,
									width:100
		                 }
							 ]
		              },{
		                  //columnWidth:.2,
						  columnWidth:.3,
						  
		                    items:[ new Ext.Button({                       
		                        text:'添加'
		                    }),new Ext.Button({                   
		                        text:'检索',
								style:'margin:5px 0 0 0'
		                    })]
		              }]
            }]
          }],
    buttons:[{
        id:'bn_submit',
        text: '生成专题',
        handler:generateTopic
    },{
		text: '关    闭',
		handler: function(){
			win.hide();
		}
    }]
});
    // Panel for the west
	var loader = new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx" });
    var rootMain = new Ext.tree.TreeNode({
        id: "fl", //根节点id
        text: "专利分类",
        qtip: "专利分类",
        leaf: false

    });
	    var _root = new Ext.tree.AsyncTreeNode({
        id: "0", //根节点id
        text: "外观专利",
        qtip: "外观专利",
        leaf: false,
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=wgfl&type=wg" })
    });

    var root = new Ext.tree.TreeNode({
        id: "IPC", //根节点id
        text: "IPC",
        qtip: "IPC",
        leaf: false,
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=IPC" })

    });



    var a = new Ext.tree.AsyncTreeNode({
        id: 'A', //子结点id
        text: 'A 人类生活需要',
        qtip: '人类生活需要',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=A" })
    });
    var b = new Ext.tree.AsyncTreeNode({
        id: 'B', //子结点id
        text: 'B 作业，运输',
        qtip: '作业，运输',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=B" })
    });
    var c = new Ext.tree.AsyncTreeNode({
        id: 'C', //子结点id
        text: 'C 化学，冶金',
        qtip: '化学，冶金',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=C" })
    });
    var d = new Ext.tree.AsyncTreeNode({
        id: 'D', //子结点id
        text: 'D 纺织和造纸',
        qtip: '纺织和造纸',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=D" })
    });
    var e = new Ext.tree.AsyncTreeNode({
        id: 'E', //子结点id
        text: 'E 固定构造',
        qtip: '固定构造',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=E" })
    });

    var f = new Ext.tree.AsyncTreeNode({
        id: 'F', //子结点id
        text: 'F 机械工程，照明，加热，武器，爆破',
        qtip: '机械工程，照明，加热，武器，爆破',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=F" })
    });

    var g = new Ext.tree.AsyncTreeNode({
        id: 'G', //子结点id
        text: 'G 物理',
        qtip: '物理',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=G" })
    });
    var h = new Ext.tree.AsyncTreeNode({
        id: 'H', //子结点id
        text: 'H 电学',
        qtip: '电学',
        loader: new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=H" })
    });

    root.appendChild(a); //为根节点增加子结点c1
    root.appendChild(b);
    root.appendChild(c);
    root.appendChild(d);
    root.appendChild(e);
    root.appendChild(f);
    root.appendChild(g);
    root.appendChild(h);

    rootMain.appendChild(root);
    rootMain.appendChild(_root);
	


	var tree = new Ext.tree.TreePanel({
		title       : 'IPC',
		region      : 'west',
		split       : true,
		width       : 200,
		//collapsible : true,
		margins     : '3 0 3 3',
		cmargins    : '3 3 3 3',
		root:rootMain
	});

	tree.on('beforeexpandnode', function(node) {
        //Ext.Msg.alert('警告！', '请选择同层次IPC分类.');
        if (node.id != 'ipc') {
            var checkedLength = tree.getChecked().length;
            for (var i = 0; i < checkedLength; i++) {
                tree.getChecked()[0].ui.toggleCheck(false);
            }
            //由此节点向前搜索，收缩前兄弟节点               
            if (!node.isFirst()) {
                var perNode = node.previousSibling;
                while (!perNode.isFirst()) {
                    perNode.collapse(true, true);
                    perNode = perNode.previousSibling;
                }
                perNode.collapse(true, true);
            }
            //由此节点向后搜索，收缩后兄第节点
            if (!node.isLast()) {
                var nextNode = node.nextSibling;
                while (!nextNode.isLast()) {
                    nextNode.collapse(true, true);
                    nextNode = nextNode.nextSibling;
                }
                nextNode.collapse(true, true);
            }
        }
    });

    tree.on('beforecollapsenode', function(node) {
        var childsLength = node.childNodes.length;
        for (var i = 0; i < childsLength; i++) {
            node.childNodes[i].ui.toggleCheck(false);
        }
    });
    tree.on("beforeload", function(node, event) {
        node.loader = new Ext.tree.TreeLoader({ url: "Processing/IPC.aspx?parent=" + node.id });
    });

    tree.on("click", function(node) {
        if (node.id != "IPC" && node.id != "fl" && node.id != "wgfl") {
            var ipcObject = document.getElementById("tb_zfl");
            if (ipcObject) {
                ipcObject.value = node.id;
            }
        }

    });
	
	var win = new Ext.Window({
		title    : '专题建立',
		closable : true,
		width    : 920,
		height   : 530,
		//border : false,
		plain    : true,
		layout   : 'border',
		items    : [tree, form]
	});

	win.show(button);
   
    var selectedCountries=new Array();
    
    function generateTopic()
    {
        getSelectedCountries();
        submitTopic();
        //alert(selectedCountries);
        //alert(document.getElementById('zfl').value);
    }
    
    function getSelectedCountries()
    {
        clearCountries();
        for(var index=0; index<broad.items.items.length; index++)
        {
            if(broad.items.items[index].checked)selectedCountries.push(broad.items.items[index].inputValue);
        }
        
        for(var index=0; index<home.items.items.length; index++)
        {
            if(home.items.items[index].checked)selectedCountries.push(home.items.items[index].inputValue);
        }
    }
    
    function clearCountries()
    {
        while(selectedCountries.length>0)selectedCountries.pop();
    }
    
    
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
       
    var currentProcessStr="";   //进度
    var dataSourceList="";      //数据源列表
    var currentTableName="";    //当前表
    var isEnd=false;            //结束标志
    var flag;                   //标志
    var ztTableName="";         //专题表名
    var queryValue="";          //表达式
    var list=new Array();
    
    function isLastDataSource() //是否是最后一个数据表
    {
        if(list[list.length-1]==currentTableName)
        {
            return true;
        }
        return false;
    }
    
    function initParameter()
    {
    
        if(dataSourceList.indexOf(',')==-1)
        {
            list.push(dataSourceList);
        }
        else
        {
             list=dataSourceList.split(',');
        }
        if(currentTableName=="")currentTableName=list[0];
        processBar.updateProgress(0,'等待........');
    }
    
    
    function getProcessStr()    //获取进度条参数
    {
        Patent.Topic.GetProcessStr(ztTableName,currentTableName,getProcessStr_callback);
    }
    
    function getProcessStr_callback(response)    //获取进度条参数回调函数
    {
        currentProcessStr=response.value;
        bindProcessStr();
        if(isEnd==false)
        {

        }
        else
        {
             clearInterval(flag);
             parseEnd();
        }
    }
    
    function bindProcessStr()   //绑定进度条
    {
        //alert(currentProcessStr);
        if(currentProcessStr=="done"&&isLastDataSource())
        {
            isEnd=true;
            processBar.updateProgress(1,'完毕!');
        }
        if(currentProcessStr=="done"&&isLastDataSource()==false)
        {
            isEnd=false;
            for(var index=0;index<list.length; index++)
            {
                if(currentTableName==list[index]&&index<list.length-1)
                {
                    currentTableName=list[index+1];
                    break;
                }
            }
        }
        if(currentProcessStr!="done")
        {
            isEnd=false;
            if(currentProcessStr=="wait")return;
            var currentIndex=parseFloat(currentProcessStr.split(',')[0]);
            var sum=parseFloat(currentProcessStr.split(',')[1]);
            //currentTableName=currentProcessStr.split(',')[2];
            if(sum==0)
            {
                isEnd=false;
                return;
            }
            p=currentIndex/sum;
            var num= parseInt(p*100)+'%';
            var str= num+' ('+currentIndex+'/'+sum+') '+parseTableName(currentTableName);
            processBar.updateProgress(p,str);
        }
    }
    
    function parseTableName(str)    //表名称转换
    {
        var returnName='';
        switch(str)
        {
            case 'uspatent' : 
            returnName='美国'; break;
            case 'jppatent' : 
            returnName='日本'; break;
            case 'gbpatent' : 
            returnName='英国'; break;
            case 'depatent' : 
            returnName='德国'; break;                
            case 'frpatent' : 
            returnName='法国'; break;
            case 'chpatent' : 
            returnName='瑞士'; break;
            case 'wopatent' : 
            returnName='世界'; break;  
            case 'eppatent' : 
            returnName='欧洲'; break;
            case 'fmzl' : 
            returnName='发明专利'; break;
            case 'wgzl' : 
            returnName='外观设计'; break;
            case 'syxx' : 
            returnName='实用新型'; break;  
            default:
            returnName='';
            break;                                                                               
                                       
        }
        return returnName;
    }
    
    function parseEnd()    //中断进度
    { 
        //alert(isEnd);
        if(isEnd)
        {
             document.getElementById('bn_submit').disabled=false;
        }
    }
    
    function getQueryString()    //获取查询表达式
    {
        var queryString="";
        
        queryString=getQueryValue()+"_"+getQueryDataSource();
        return queryString;  
    }
    
    function getElementValue(id)    //获取HTML标签的值
    {
        var value="";
        var element=document.getElementById(id);
        if(element)
        {
             value=element.value;
        }
        return value;
    }
    
    function getCheckBoxValue(id)    //获取CheckBox的值
    {
        var value=false;
        var element=document.getElementById(id);
        if(element)
        {
             value=element.checked;
        }
        return value;
    }
    
    function isBlank(value)         //判断值是否为空
    {
        if(value==null||value=="") return true;
        return false;
    }
    
    function getQueryValue()        //获取查询条件连接表达式
    {
         var sqh=getElementValue("tb_sqh");
         var sqrq_lower_1=getElementValue("tb_sqrq_lower_1");
         var sqrq_upper_1=getElementValue("tb_sqrq_upper_1");
         var ggh=getElementValue("tb_ggh");
         var ggrq_lower=getElementValue("tb_ggrq_lower");
         var ggrq_upper=getElementValue("tb_ggrq_upper");
         var zlh=getElementValue("tb_zlh");
         var sqrq_lower=getElementValue("tb_sqrq_lower");
         var sqrq_upper=getElementValue("tb_sqrq_upper");
         var mc=getElementValue("tb_mc");
         var fmr=getElementValue("tb_fmr");
         var sqr=getElementValue("tb_sqr");
         var dz=getElementValue("tb_dz");
         var zfl=getElementValue("tb_zfl");
         var fl=getElementValue("tb_fl");
         var qlyq=getElementValue("tb_qlyq");
         var zy=getElementValue("tb_zy");
         var yxq=getElementValue("tb_yxq");
         
         var returnValue="";
//         if(isBlank(sqh)==false)
//         {
//              if(isBlank(returnValue))returnValue=returnValue+"#A="+sqh;
//              else returnValue=returnValue+" and #A="+sqh;
//         }
//         
         if(isBlank(sqrq_lower_1)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#A>='"+sqrq_lower_1+"'";
              else returnValue=returnValue+" and #A>='"+sqrq_lower_1+"'";
         }
         if(isBlank(sqrq_upper_1)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#A<='"+sqrq_upper_1+"'";
              else returnValue=returnValue+" and #A<='"+sqrq_upper_1+"'";
         }
         
//         if(isBlank(ggh)==false)
//         {
//              if(isBlank(returnValue))returnValue=returnValue+"#C="+ggh;
//              else returnValue=returnValue+" and #C="+ggh;
//         }
         
         if(isBlank(ggrq_lower)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#B>='"+ggrq_lower+"'";
              else returnValue=returnValue+" and #B>='"+ggrq_lower+"'";
         }
         if(isBlank(ggrq_upper)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#B<='"+ggrq_upper+"'";
              else returnValue=returnValue+" and #B<='"+ggrq_upper+"'";
         }
         
//         if(isBlank(zlh)==false)
//         {
//              if(isBlank(returnValue))returnValue=returnValue+"#E="+zlh;
//              else returnValue=returnValue+" and #E="+zlh;
//         }
         
         if(isBlank(sqrq_lower)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#C>='"+sqrq_lower+"'";
              else returnValue=returnValue+" and #C>='"+sqrq_lower+"'";
         }
         if(isBlank(sqrq_upper)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#C<='"+sqrq_upper+"'";
              else returnValue=returnValue+" and #C<='"+sqrq_upper+"'";
         }
         
//         if(isBlank(mc)==false)
//         {
//              if(isBlank(returnValue))returnValue=returnValue+"#G=%"+mc+"%";
//              else returnValue=returnValue+" and #G=%"+mc+"%";
//         }
         
         if(isBlank(fmr)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#D like '%"+fmr+"%'";
              else returnValue=returnValue+" and #D like '%"+fmr+"%'";
         }
         
          
         if(isBlank(sqr)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#E like '%"+sqr+"%'";
              else returnValue=returnValue+" and #E=%"+sqr+"%";
         }
         
          
         if(isBlank(zfl)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#F like '%"+zfl+"%'";
              else returnValue=returnValue+" and #F like '"+zfl+"%'";
         }
         
         if(isBlank(fl)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#G="+fl+"%";
              else returnValue=returnValue+" and #G like '"+fl+"%'";
         }
         
         if(isBlank(dz)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#H like '"+dz+"%'";
              else returnValue=returnValue+" and #H like '%"+dz+"%'";
         }
         
                
         if(isBlank(qlyq)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#I like '%"+qlyq+"%'";
              else returnValue=returnValue+" and #I like '%"+qlyq+"%'";
         }
         
         if(isBlank(zy)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#J like '%"+zy+"%'";
              else returnValue=returnValue+" and #J like '%"+zy+"%'";
         }
         
         if(isBlank(yxq)==false)
         {
              if(isBlank(returnValue))returnValue=returnValue+"#K like '%"+yxq+"%'";
              else returnValue=returnValue+" and #K like '%"+yxq+"%'";
         }
         
         return returnValue;
    }
    
    function getQueryDataSource()     //获取数据查询范围
    {
        return selectedCountries.toString();
    }
    
    function submitTopic()
    {

        dataSourceList=getQueryDataSource();
        queryValue=getQueryValue();
        
        var ljysValue=getElementValue("tb_ljys");
        if(isBlank(ljysValue)==false)
        {
           queryValue=ljysValue;
        }
        if(dataSourceList=="")
        {
            error("必须选择查询范围!");
            return false;
        }
        document.getElementById('bn_submit').disabled=true;
       // alert(returnValue);
        var ztmc=getElementValue("tb_mc");
        Patent.Topic.CreateTopic(ztmc,queryValue+"_"+dataSourceList,submitTopic_callback);
        return false;
    }
    
    function submitTopic_callback(response)
    {
        var value=response.value;
       // alert(value);
        if(isBlank(value))
        {
            error("发生错误!");
            return ;
        }
        ztTableName=value.split(',')[1];
        Patent.Topic.ProcessQuery(value,queryValue+"_"+dataSourceList,ProcessQuery_callback);
       
        if(currentTableName=="")initParameter();
        flag=setInterval(getProcessStr,500);
    }
    
  
    function ProcessQuery_callback(response)
    {
        //isEnd=true;
        parseEnd();
    }
    function error(type)
    {
        //alert(type);
           Ext.MessageBox.show({
           title: '错误',
           msg: type,
           width:250,
           buttons: Ext.MessageBox.OK,
           icon: Ext.MessageBox.ERROR
       });
    }
    
    function addLogicSelected()
    {
        var logicElement=document.getElementById('logic_select');
        var logicValue=logicElement.options[logicElement.selectedIndex].innerHTML;
        var logicTextElement=document.getElementById('tb_ljys');
        logicTextElement.value+=' '+logicValue+ ' ';
    }
}
